package pixeleditor.ctrl.impl;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JColorChooser;

import common.ctrl.IObserver;
import common.gui.IViewable;

import pixeleditor.core.Board;

public class ChooseColorCtrl extends MouseAdapter implements IObserver {
	
	private IViewable iv;
	
	@Override
	public void mouseClicked(MouseEvent e) {
		Board.getInstance().getPaintSetup().setCurrentColor(
				JColorChooser.showDialog(null, "", 
						Board.getInstance().getPaintSetup().getCurrentColor()));
		iv.updateView(Board.getInstance().getPaintSetup().getCurrentColor());
	}
	
	@Override
	public void addView(IViewable iv) {
		this.iv = iv;
	}
}
